import { createSlice } from '@reduxjs/toolkit'

const initialState = {
  value: 0,
  chelist:[
    {
        id:'1',
        name:"张三",
        tel:"13111111111",
        code:"1465465465465465"
    },
    {
        id:'2',
        name:"张四",
        tel:"13333333333",
        code:"555555555555555"
    },
  ]
}

export const TranList = createSlice({
  name: 'counter',
  initialState,
  reducers: {
    delche(state,action){
      state.chelist = state.chelist.filter(v=>v.id != action.payload)
    },
    addche(state,action){
      state.chelist.push(action.payload)
    }
  },
})

// Action creators are generated for each case reducer function
export const {delche,addche} = TranList.actions

